package ca.cbc.giscommon.dao;

import ca.cbc.giscommon.entity.Source;
import org.hibernate.criterion.Restrictions;

import java.util.List;

public class SourceDAO extends EntityHome<Source> {

    @Override
    public String getFullClassName() {
        return Source.class.getCanonicalName();
    }

    @SuppressWarnings("unchecked")
	public List<Source> listBySourceType(String sourceType) {
        return getCurrentSession().createCriteria(getFullClassName())
                .add(Restrictions.eq("sourceType", sourceType)).list();
    }

    @SuppressWarnings("unchecked")
	public List<Source> listBySourceTypes(String[] sourceTypes) {
        return getCurrentSession().createCriteria(getFullClassName())
                .add(Restrictions.in("sourceType", sourceTypes)).list();
    }
}
